Skip to content

Labb3 - #1

Open
kappsegla wants to merge 14 commits into
mainfrom
labb3
Open

Labb3#1
kappsegla wants to merge 14 commits into
mainfrom
labb3

Conversation

@kappsegla

@kappsegla kappsegla commented Nov 19, 2025

Copy link
Copy Markdown

Summary by CodeRabbit

  • UI Changes

    • Redesigned interface to a chat-style layout with a top title, read-only message area, text input, and buttons for attaching files and sending messages.
  • Refactor

    • Removed several internal helper and connection implementations to streamline the codebase.
  • Tests

    • Removed a test helper class used for connection testing.
  • Chores

    • Cleaned up build configuration details.

@coderabbitai

coderabbitai Bot commented Nov 19, 2025

Copy link
Copy Markdown

Walkthrough

Removed several Java classes (ManyParameters, ManyParametersBuilder, NtfyConnection, NtfyConnectionImpl, Singelton, NtfyConnectionSpy), updated the UI FXML from a StackPane single-label layout to a BorderPane chat interface, and removed the explicit Surefire plugin version from pom.xml.

Changes

Cohort / File(s) Summary
Builder pattern removal
src/main/java/com/example/ManyParameters.java, src/main/java/com/example/ManyParametersBuilder.java
Deleted the ManyParameters class and its constructor, and the ManyParametersBuilder class with its setter methods and factory method.
Messaging infra removal
src/main/java/com/example/NtfyConnection.java, src/main/java/com/example/NtfyConnectionImpl.java
Deleted the NtfyConnection interface (send/receive) and NtfyConnectionImpl implementation (HTTP client send/receive logic).
Singleton removal
src/main/java/com/example/Singelton.java
Deleted the eagerly-initialized singleton class and its getInstance() accessor.
Test helper removal
src/test/java/com/example/NtfyConnectionSpy.java
Deleted the test spy that implemented NtfyConnection.
UI layout refactor
src/main/resources/com/example/hello-view.fxml
Replaced StackPane single Label layout with a BorderPane: top title Label, center read-only chat TextArea, bottom input bar with TextField and Buttons bound to onAttachFileClick and onSendButtonClick. Controller unchanged.
Build file tweak
pom.xml
Removed explicit Maven Surefire plugin <version> entry (previously 3.2.5), relying on inherited/default version.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify no remaining references/usages of the deleted classes/interfaces across the codebase and tests.
  • Confirm HelloController implements onAttachFileClick(...) and onSendButtonClick(...) and that UI control fx:id values used in controller match the FXML.
  • Review build behavior after removing Surefire version (CI may pick a different plugin version).
  • Inspect any serialization, DI, or wiring that previously relied on NtfyConnection/NtfyConnectionImpl or Singelton.

Poem

🐰 I hopped through code with eager cheer,

Builders, singletons — disappear!
A BorderPane now holds the chat,
Buttons to press, and text to pat,
A little rabbit claps — hooray, new draft! 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Labb3' is vague and non-descriptive, providing no meaningful information about the substantial changes in the pull request. Replace with a descriptive title that summarizes the main changes, such as 'Remove deprecated classes and refactor UI to BorderPane' or 'Clean up builder pattern and replace with simplified architecture'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch labb3

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9534fea and 1f3ce53.

📒 Files selected for processing (1)
  • pom.xml (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • pom.xml

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/main/resources/com/example/hello-view.fxml (2)

17-23: Consider removing fixed dimensions for better responsiveness.

The prefHeight and prefWidth attributes set fixed dimensions. While these provide initial size hints, they may not adapt well to different screen sizes or window resizing. Since this TextArea is in the center of a BorderPane, it will naturally fill available space.

Apply this diff to remove fixed dimensions and let the layout manager handle sizing:

         <TextArea fx:id="chatArea"
                   editable="false"
                   wrapText="true"
-                  prefHeight="400"
-                  prefWidth="600"
                   styleClass="chat-area"/>

26-35: Consider adding keyboard shortcuts and accessibility enhancements.

The input bar lacks keyboard shortcuts (e.g., pressing Enter to send) and accessibility labels. Consider:

  • Add onAction="#onSendButtonClick" to the TextField so Enter sends the message
  • Add tooltip or accessible text for screen readers
  • Consider keyboard shortcut hints in button text or tooltips

Example enhancement for Enter-to-send functionality:

-            <TextField fx:id="inputField" HBox.hgrow="ALWAYS" promptText="Skriv ett meddelande..." styleClass="chat-input"/>
+            <TextField fx:id="inputField" HBox.hgrow="ALWAYS" promptText="Skriv ett meddelande..." onAction="#onSendButtonClick" styleClass="chat-input"/>
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b83363 and 9534fea.

📒 Files selected for processing (7)
  • src/main/java/com/example/ManyParameters.java (0 hunks)
  • src/main/java/com/example/ManyParametersBuilder.java (0 hunks)
  • src/main/java/com/example/NtfyConnection.java (0 hunks)
  • src/main/java/com/example/NtfyConnectionImpl.java (0 hunks)
  • src/main/java/com/example/Singelton.java (0 hunks)
  • src/main/resources/com/example/hello-view.fxml (1 hunks)
  • src/test/java/com/example/NtfyConnectionSpy.java (0 hunks)
💤 Files with no reviewable changes (6)
  • src/main/java/com/example/NtfyConnectionImpl.java
  • src/test/java/com/example/NtfyConnectionSpy.java
  • src/main/java/com/example/ManyParameters.java
  • src/main/java/com/example/Singelton.java
  • src/main/java/com/example/NtfyConnection.java
  • src/main/java/com/example/ManyParametersBuilder.java
🔇 Additional comments (1)
src/main/resources/com/example/hello-view.fxml (1)

6-8: No issues found. HelloController properly implements all required FXML bindings and handlers.

The verification confirms that com.example.HelloController correctly declares all referenced fields (chatArea, inputField) and action handlers (onSendButtonClick, onAttachFileClick) with proper @FXML annotations. The FXML file is properly backed by controller implementation.

Comment on lines +12 to +33
<Label text="Java Chat" BorderPane.alignment="CENTER" styleClass="app-title"/>
</top>

<!-- Chattområde -->
<center>
<TextArea fx:id="chatArea"
editable="false"
wrapText="true"
prefHeight="400"
prefWidth="600"
styleClass="chat-area"/>
</center>

<!-- Inputfält och knappar längst ner -->
<bottom>
<HBox spacing="10" styleClass="input-bar">
<padding>
<Insets top="10" right="10" bottom="10" left="10"/>
</padding>
<TextField fx:id="inputField" HBox.hgrow="ALWAYS" promptText="Skriv ett meddelande..." styleClass="chat-input"/>
<Button text="Attach File" onAction="#onAttachFileClick" styleClass="attach-btn"/>
<Button text="Send" onAction="#onSendButtonClick" styleClass="send-btn"/>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify CSS file exists with required style classes.

The FXML references several style classes: app-title, chat-area, input-bar, chat-input, attach-btn, and send-btn. Ensure a corresponding CSS file is loaded by the controller or application and defines these classes.

Run the following script to locate CSS files and check for style class definitions:


🏁 Script executed:

#!/bin/bash
# Description: Find CSS files and verify style class definitions

# Find all CSS files in resources
echo "=== CSS files in resources ==="
fd -e css . src/main/resources

# Search for style class definitions
echo -e "\n=== Searching for style class definitions ==="
rg -n --type=css 'app-title|chat-area|input-bar|chat-input|attach-btn|send-btn' src/main/resources

Length of output: 587


🏁 Script executed:

#!/bin/bash
# Verify CSS is loaded in FXML or application code

echo "=== Checking if CSS is loaded in FXML ==="
rg -n 'getStylesheets|stylesheets|Style.css' src/main/resources/com/example/ --type=fxml

echo -e "\n=== Checking controller and main application files ==="
fd -e java src/main/java | head -20 | xargs -I {} rg -l 'getStylesheets|stylesheets|Style.css' {}

echo -e "\n=== Listing Java controller files ==="
fd -e java src/main/java -path '*/example/*'

Length of output: 334


🏁 Script executed:

#!/bin/bash
# Verify CSS is loaded in application code

echo "=== Searching for CSS loading in Java files ==="
rg -n 'getStylesheets|Style\.css|stylesheets' src/main/java/

echo -e "\n=== Listing Java files in example package ==="
fd -e java src/main/java

echo -e "\n=== Checking for FXML root element with stylesheets ==="
rg -n 'stylesheets|<.*stylesheet' src/main/resources/com/example/

Length of output: 644


🏁 Script executed:

#!/bin/bash
# Verify exact CSS filename and check for case-sensitivity issues

echo "=== List all files in com/example resources directory ==="
fd . src/main/resources/com/example/

echo -e "\n=== Check exact CSS filename ==="
ls -la src/main/resources/com/example/ | grep -i css

echo -e "\n=== Show HelloFX.java CSS loading line ==="
rg -A2 -B2 'getStylesheets' src/main/java/com/example/HelloFX.java

Length of output: 432


Fix filename case-sensitivity mismatch between CSS file and Java loader.

All required style classes are defined in the CSS file, but there is a critical mismatch: the CSS file is named Style.css (capital S) while the Java code at src/main/java/com/example/HelloFX.java:21 loads "style.css" (lowercase s). On case-sensitive filesystems, this will prevent the CSS from loading, leaving the UI unstyled.

Either rename the CSS file to style.css or update the Java code to load "Style.css".

🤖 Prompt for AI Agents
In src/main/resources/com/example/hello-view.fxml lines 12-33: the review
reports a case-sensitivity mismatch between the CSS filename (Style.css) and the
Java loader in src/main/java/com/example/HelloFX.java:21 which loads
"style.css"; fix by either renaming the resource file to style.css (lowercase s)
in src/main/resources (preferred for consistency) or update the string in
HelloFX.java line 21 to "Style.css" so the filename exactly matches the
resource; ensure the build includes the renamed file and update any references
elsewhere.

@Ericthilen
Ericthilen force-pushed the main branch 2 times, most recently from 9a41f79 to 21c51e8 Compare November 19, 2025 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant